#ifndef SHORTCUT_HPP
#define SHORTCUT_HPP

#include <QtGui/QAction>
#include <QtGui/QKeySequence>
#include <QtCore/QString>
#include <QxtGui/QxtGlobalShortcut>

/**
 * @brief The Shortcut class is used to handle application and system shortcuts
 */
class Shortcut : public QObject {
     Q_OBJECT
private:
    bool global;
    QString name;
    QAction *applicationShortcut;
    QxtGlobalShortcut *globalShortcut;
public:
    /** @brief Contruct that sets the name and if it is a global key sequence
     * @param name Key name that describe the shortcut
     * @param global True if the shortcut is global and false if it used only on the application
    */
    Shortcut(QString name, bool global = false);
    ~Shortcut();
    /** @brief Tells if the shortcut is global
     * @return True if the shortcut is global and false if it used only on the application
     */
    bool isGlobal();
    /** @brief Key name that describe the shortcut
     * @return Key name without spaces
     */
    QString getName();
    /**  @brief Set the key sequence of the shortcut
     * @param shortcut Key sequence
     * @return True on success
     */
    bool set(const QKeySequence & shortcut);
    /// * @brief Get the key sequence of the shortcut
    QKeySequence get() const;
    /// @brief Get the shortcut object: a QAction or a QxtGlobalShortcut
    QObject* getObject() const;
    /// @brief Get the key sequence as string
    QString getStringSequence();
};

#endif // SHORTCUT_HPP
